package com.lanou.wuyou.one.guide;

import android.content.ContentResolver;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.lanou.wuyou.one.MainActivity;
import com.lanou.wuyou.one.R;

/**
 * Created by dllo on 17/3/9.
 */

public class GuideActivity extends AppCompatActivity{
    public static final String PICTURE_URL = "https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1489073224135&di=823eb0100c1ad48dd09053e855bdc763&imgtype=0&src=http%3A%2F%2Fimg4.duitang.com%2Fuploads%2Fitem%2F201601%2F28%2F20160128155232_rNdQk.thumb.700_0.jpeg";
    private ImageView imageView;
    private Async async;
    private TextView jumpTv,numberTv;
    private ContentResolver contentResolver;
    private Handler handler;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_guide);

        imageView = (ImageView) findViewById(R.id.guide_iv);
        jumpTv = (TextView) findViewById(R.id.jump_tv);
        numberTv = (TextView) findViewById(R.id.number_tv);

        jumpTv.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                async.cancel(true);
                Intent intent = new Intent(GuideActivity.this, MainActivity.class);
                startActivity(intent);
                finish();
            }
        });

        //获取图片
        ImageLoader imageLoader = new ImageLoader();
        imageLoader.getImg(PICTURE_URL,imageView);
        Log.e("image", "onCreate: " + String.valueOf(imageLoader) );

        async = new Async();
        async.setTextView(jumpTv);
        async.setContext(this);
        async.execute(1,2,3,4,5);//往Async里的doInBackground传
        async.setGuideActivity(this);

    }
}
